package com.itheima.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.itheima.po.Student;
import com.itheima.service.StudentService;
@Controller
public class StudentController {
	@Autowired
	private StudentService studentService;
	
	/**
	 * 根据id查询客户详情
	 */
	@RequestMapping("/goToLogin")
	public String goToLogin(){
		System.out.println("goToLogin.....Controller");
		return "login";
	}
	
	/**
	 * 根据id查询客户详情
	 */
	@RequestMapping("/login")
	public String login(String name,String passwd,Model model) {
		System.out.println("login.....Controller");
		Student student = new Student();
		student.setName(name);
		student.setPasswd(passwd);
		boolean isLogin = studentService.login(student);
		String jsp_dir = "login";
		if(isLogin){
			jsp_dir = "index";
		}
		//model.addAttribute("customer", customer);
		//返回客户信息展示页面
		return jsp_dir;
	}
}
